#include "TradeLvData.h"
#include "TradeLvDef.h"

static int g_LanguageType = 0;

void TradeLvData_ParseIdentifyCodeData(ROW_NODE* aNode, char* aIdentifyCode)
{
	
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	COL_NODE *pFields = aNode->next->node;
	COL_NODE *pItem = aNode->next->next->node;
	
	while (pFields && pItem)
	{
        if (g_LanguageType == 1) {
            if (strcmp(pFields->text,LOC_TRADE_IDENTIFY_CODE_HK) == 0)
            {
                strcpy(aIdentifyCode,pItem->text);
                break;
            }
        }
        else
        {
            if (strcmp(pFields->text,LOC_TRADE_IDENTIFY_CODE_JT) == 0)
            {
                strcpy(aIdentifyCode,pItem->text);
                break;
            }
        }

		
		pFields = pFields->next;
		pItem = pItem->next;
	}
}


void TradeLvData_ParseExpandFundData(ROW_NODE* aNode, char* aExpandFundData)
{
	
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	COL_NODE *pFields = aNode->next->node;
	COL_NODE *pItem = aNode->next->next->node;
	
	while (pFields && pItem)
	{
        if (g_LanguageType == 1) {
            if (strcmp(pFields->text,LOC_TRADE_ABLEFUND_HK) == 0)
            {
                strcpy(aExpandFundData,pItem->text);
                break;
            }
        }
        else
        {
            if (strcmp(pFields->text,LOC_TRADE_ABLEFUND_JT) == 0)
            {
                strcpy(aExpandFundData,pItem->text);
                break;
            }
        }
        
		
		pFields = pFields->next;
		pItem = pItem->next;
	}
}

void TradeLvData_ParseLoginData(ROW_NODE* aNode, TRADELV_LOGIN_RES *aRes)
{
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	memset(aRes,0,sizeof(TRADELV_LOGIN_RES));
	
	COL_NODE *pName = aNode->next->node;
	COL_NODE *pNum = aNode->next->next->node;
	
	while (pName && pNum && aRes->nCount < TRADELV_ACCOUNT_MAXCOUNT)
	{
        if (g_LanguageType == 1)
        {
            //printf("\n %s   %s  %d\n",pName->text,pNum->text,strlen(pNum->text));
            if (strcmp(pName->text,LOC_TRADE_GONGAO_HK) == 0)
            {
                strcpy(aRes->pNotice,pNum->text);
                pName = pName->next;
                pNum = pNum->next;
            }
            else if (strcmp(pName->text, LOC_TRADE_RISKINFO_HK) == 0)
            {
                strcpy(aRes->pRiskInfo,pNum->text);
                pName = pName->next;
                pNum = pNum->next;
            }
            else
            {
                strcpy(aRes->pAccount[aRes->nCount].sName, pName->text);
                strcpy(aRes->pAccount[aRes->nCount].sNum, pNum->text);
                
                if (strcmp(pName->text, LOC_TRADE_FUNDJJ_ZZZH_HK) == 0)
                {
                    strcpy(aRes->pCapitalAccount, pNum->text);
                }
                
                pName = pName->next;
                pNum = pNum->next;
                aRes->nCount++;
            }
        }
        else{
            //printf("\n %s   %s  %d\n",pName->text,pNum->text,strlen(pNum->text));
            if (strcmp(pName->text,LOC_TRADE_GONGAO_JT) == 0)
            {
                strcpy(aRes->pNotice,pNum->text);
                pName = pName->next;
                pNum = pNum->next;
            }
            else if (strcmp(pName->text, LOC_TRADE_RISKINFO_JT) == 0) {
                strcpy(aRes->pRiskInfo,pNum->text);
                pName = pName->next;
                pNum = pNum->next;
            }
            else
            {
                strcpy(aRes->pAccount[aRes->nCount].sName, pName->text);
                strcpy(aRes->pAccount[aRes->nCount].sNum, pNum->text);
                
                if (strcmp(pName->text, LOC_TRADE_FUNDJJ_ZZZH_JT) == 0)
                {
                    strcpy(aRes->pCapitalAccount, pNum->text);
                }
                
                pName = pName->next;
                pNum = pNum->next;
                aRes->nCount++;
            }
        }
	}
	
}

void TradeLvData_ParseBankCodeData(ROW_NODE* aNode, TRADELV_BANKCODE_RES *aRes)
{
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
    memset(aRes, 0, sizeof(TRADELV_BANKCODE_RES));
	COL_NODE *pFile = aNode->next->node;
	ROW_NODE *pLine = aNode->next->next;
	COL_NODE *pItem;
	aRes->nCount = 0;
	while(pLine)
	{
		pItem = pLine->node;
		while(pFile && pItem)
		{
            if (g_LanguageType == 1) {
                if(strcmp(pFile->text, LOC_TRADE_BANK_ID_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankID, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_NAME_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankName, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_ACCOUNT_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankAccount, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_TYPE_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_MONEY_TYPE_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_MODE_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankMode, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_STATUS_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassStatus, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_WORD_IN_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassIn, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_WORD_OUT_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassOut, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_ZJZH_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iFundAccount, pItem->text);
                }
                //add by jason 余额密码标志
                else if(strcmp(pFile->text, LOC_TRADE_BANK_BANLANCE_PASS_HK) == 0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankBanlance, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEY_HK)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iMoney, pItem->text);
                }
                //end
            }else
            {
                if(strcmp(pFile->text, LOC_TRADE_BANK_ID_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankID, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_NAME_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankName, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_ACCOUNT_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankAccount, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_TYPE_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_MONEY_TYPE_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_MODE_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankMode, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_STATUS_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassStatus, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_WORD_IN_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassIn, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_BANK_PASS_WORD_OUT_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankPassOut, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_ZJZH_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iFundAccount, pItem->text);
                }
                //add by jason 余额密码标志
                else if(strcmp(pFile->text, LOC_TRADE_BANK_BANLANCE_PASS_JT) == 0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iBankBanlance, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEY_JT)==0)
                {
                    strcpy(aRes->pBank[aRes->nCount].iMoney, pItem->text);
                }
                //end
            }

			pFile = pFile->next;
			pItem = pItem->next;
		}
		
		pFile = aNode->next->node;
		aRes->nCount++;
		pLine = pLine->next;
	}
}

void TradeLvData_ParseAccountCodeData(ROW_NODE* aNode, TRADELV_ACCOUNTCODE_RES *aRes)
{
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	COL_NODE *pFile = aNode->next->node;
	ROW_NODE *pLine = aNode->next->next;
	COL_NODE *pItem;
	aRes->nCount = 0;
	while(pLine)
	{
		pItem = pLine->node;
		while(pFile && pItem)
		{
            if (g_LanguageType == 1 ) {
                if(strcmp(pFile->text, LOC_TRADE_TRANSFER_ACCOUNT_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccount, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_NAME_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountName, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_TYPE_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountType, pItem->text);
                    
                    if (strcmp(aRes->pAccount[aRes->nCount].iAccountType, LOC_TRADE_TRANSFER_MAIN_JT) == 0) {
                        aRes->nIndex = aRes->nCount;
                    }
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEYTYPE_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEY_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iMoney, pItem->text);
                }
            }
            else
            {
                if(strcmp(pFile->text, LOC_TRADE_TRANSFER_ACCOUNT_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccount, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_NAME_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountName, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_TYPE_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountType, pItem->text);
                    
                    if (strcmp(aRes->pAccount[aRes->nCount].iAccountType, LOC_TRADE_TRANSFER_MAIN_JT) == 0) {
                        aRes->nIndex = aRes->nCount;
                    }
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEYTYPE_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iAccountMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_TRANSFER_MONEY_JT)==0)
                {
                    strcpy(aRes->pAccount[aRes->nCount].iMoney, pItem->text);
                }            }
			
			pFile = pFile->next;
			pItem = pItem->next;
		}
		
		pFile = aNode->next->node;
		aRes->nCount++;
		pLine = pLine->next;
	}
}

void TradeLvData_ParseBuySellData(ROW_NODE* aNode, TRADELV_BUYSELL_RES *aRes)
{
	if (aNode == NULL || aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
  memset(aRes, 0, sizeof(TRADELV_BUYSELL_RES));
  
	COL_NODE *pFields = aNode->next->node;
	COL_NODE *pItem = aNode->next->next->node;
	
	while (pFields && pItem)
	{
//        //Test
//        printf("\n %s   %s  %d\n",pFields->text,pItem->text,strlen(pItem->text));
//        /////////
        
        if (g_LanguageType == 0) {
            // (股票代码)
            if (strcmp(pFields->text, LOC_TRADE_STOCK_CODE_JT) == 0)
            {
                strcpy(aRes->StkCode,pItem->text);
            }
            // 证券名称(股票名称)
            else if (strcmp(pFields->text, LOC_TRADE_STOCK_NAME_JT) == 0)
            {
                strcpy(aRes->StkName,pItem->text);
            }
            // 股东代码(市场代码)
            else if (strcmp(pFields->text, LOC_TRADE_EXCHANGE_NUM_JT) == 0)
            {
                strcpy(aRes->MarketId,pItem->text);
            }
            //(可买数量)
            else if (strcmp(pFields->text, LOC_TRADE_BUYABLE_NUMBER_JT) == 0)
            {
                strcpy(aRes->BuyNum,pItem->text);
            }
            // (可用股数)
            else if (strcmp(pFields->text, LOC_TRADE_USEABLE_NUMBER_JT) == 0)
            {
                strcpy(aRes->SellNum,pItem->text);
            }
            // 卖3价(卖3价)
            else if (strcmp(pFields->text, LOC_TRADE_SAL3_PRICE_JT) == 0)
            {
                strcpy(aRes->SPri3,pItem->text);
            }
            // 卖2价(卖2价)
            else if (strcmp(pFields->text, LOC_TRADE_SAL2_PRICE_JT) == 0)
            {
                strcpy(aRes->SPri2,pItem->text);
            }
            // 卖1价(卖1价)
            else if (strcmp(pFields->text, LOC_TRADE_SAL1_PRICE_JT) == 0)
            {
                strcpy(aRes->SPri1,pItem->text);
            }
            // 买1价(买1价)
            else if (strcmp(pFields->text, LOC_TRADE_BUY1_PRICE_JT) == 0)
            {
                strcpy(aRes->BPri1,pItem->text);
            }
            // 买2价(买2价)
            else if (strcmp(pFields->text, LOC_TRADE_BUY2_PRICE_JT) == 0)
            {
                strcpy(aRes->BPri2,pItem->text);
            }
            // 买3价(买3价)
            else if (strcmp(pFields->text, LOC_TRADE_BUY3_PRICE_JT) == 0)
            {
                strcpy(aRes->BPri3,pItem->text);
            }
            // 卖5价(卖5价)
            else if(strcmp(pFields->text, LOC_TRADE_SAL5_PRICE_JT ) == 0 )
            {
                strcpy(aRes->SPri5,pItem->text);
            }
            // 卖4价(卖4价)
            else if(strcmp(pFields->text, LOC_TRADE_SAL4_PRICE_JT) == 0 )
            {
                strcpy(aRes->SPri4,pItem->text);
            }
            // 买4价(买4价)
            
            else if( strcmp( pFields->text, LOC_TRADE_BUY4_PRICE_JT) == 0 )
            {
                strcpy(aRes->BPri4,pItem->text);
            }
            // 买5价(买5价)
            else if(strcmp(pFields->text, LOC_TRADE_BUY5_PRICE_JT) == 0 )
            {
                strcpy(aRes->BPri5,pItem->text);
            }
            // 卖3量(卖3量)
            else if (strcmp(pFields->text, LOC_TRADE_SAL3_VOL_JT) == 0)
            {
                strcpy(aRes->SVol3,pItem->text);
            }
            // 卖2量(卖2量)
            else if (strcmp(pFields->text, LOC_TRADE_SAL2_VOL_JT) == 0)
            {
                strcpy(aRes->SVol2,pItem->text);
            }
            // 卖1量(卖1量)
            else if (strcmp(pFields->text, LOC_TRADE_SAL1_VOL_JT) == 0)
            {
                strcpy(aRes->SVol1,pItem->text);
            }
            // 买1量(买1量)
            else if (strcmp(pFields->text, LOC_TRADE_BUY1_VOL_JT) == 0)
            {
                strcpy(aRes->BVol1,pItem->text);
            }
            // 买2量(买2量)
            else if (strcmp(pFields->text, LOC_TRADE_BUY2_VOL_JT) == 0)
            {
                strcpy(aRes->BVol2,pItem->text);
            }
            // 买3量(买3量)
            else if (strcmp(pFields->text, LOC_TRADE_BUY3_VOL_JT) == 0)
            {
                strcpy(aRes->BVol3,pItem->text);
            }
            // 卖5量(卖5量)
            else if(strcmp(pFields->text, LOC_TRADE_SAL5_VOL_JT) == 0 )
            {
                strcpy(aRes->SVol5,pItem->text);
            }
            // 卖4量(卖4量)
            else if(strcmp(pFields->text, LOC_TRADE_SAL4_VOL_JT) == 0 )
            {
                strcpy(aRes->SVol4,pItem->text);
            }
            // 买4量(买4量)
            
            else if( strcmp( pFields->text, LOC_TRADE_BUY4_VOL_JT) == 0 )
            {
                strcpy(aRes->BVol4,pItem->text);
            }
            // 买5量(买5量)
            else if(strcmp(pFields->text, LOC_TRADE_BUY5_VOL_JT) == 0 )
            {
                strcpy(aRes->BVol5,pItem->text);
            }
            // 最新(当前价,最近价格)
            else if (strcmp(pFields->text, LOC_TRADE_CUR_PRICE_JT) == 0 || strcmp(pFields->text, LOC_TRADE_NEW_PRICE_JT) == 0)
            {
                strcpy(aRes->CurPri,pItem->text);
            }
            // 昨收(昨收盘)
            else if (strcmp(pFields->text, LOC_TRADE_PRE_PRICE_JT) == 0)
            {
                strcpy(aRes->ZSPri,pItem->text);
            }
            // 涨停(涨停)
            else if (strcmp(pFields->text, LOC_TRADE_MAX_DIF_PRICE_JT) == 0)
            {
                strcpy(aRes->ZT,pItem->text);
            }
            // 跌停(跌停)
            else if (strcmp(pFields->text, LOC_TRADE_MIN_DIF_PRICE_JT) == 0)
            {
                strcpy(aRes->DT,pItem->text);
            }
            // 涨幅(涨幅)
            else if (strcmp(pFields->text, LOC_TRADE_ZF_PRICE_JT) == 0)
            {
                strcpy(aRes->ZF,pItem->text);
            }
            // 最小变动单位
            else if (strcmp(pFields->text, LOC_TRADE_MIN_UNIT_JT) == 0)
            {
                strcpy(aRes->MinUnit,pItem->text);
            }
            // 股东代码
            else if (strcmp(pFields->text, LOC_TRADE_HODLER_ACCOUNT_JT) == 0)
            {
                strcpy(aRes->StockHolderAccount, pItem->text);
            }
            // 认购上限
            else if (strcmp(pFields->text, LOC_TRADE_SUB_MAX_JT) == 0)
            {
                strcpy(aRes->SubscribeMax, pItem->text);
            }
            // 申购上限
            else if (strcmp(pFields->text, LOC_TRADE_SUB_APP_MAX_JT) == 0)
            {
                strcpy(aRes->SubscribeAppMax,pItem->text);
            }
            /// 可用金额
            else if (strcmp(pFields->text, LOC_TRADE_MAX_MONEY_JT) == 0)
            {
                strcpy(aRes->Money, pItem->text);
            }
            /// 赎回上限
            else if (strcmp(pFields->text, LOC_TRADE_MAX_SELL_JT) == 0)
            {
                strcpy(aRes->RansomMax, pItem->text);
            }
            /// 现手
            else if(strcmp(pFields->text,LOC_TRADE_CUR_VOL_JT) == 0)
            {
                strcpy(aRes->CurrentVol, pItem->text);
            }
            /// 风险提示
            else if(strcmp(pFields->text, LOC_TRADE_RISKINFO_SB_JT) == 0)
            {
                strcpy(aRes->pRiskInfoSB, pItem->text);
            }
            /// 当前汇率
            else if(strcmp(pFields->text, LOC_TRADE_CUR_HL_JT) == 0)
            {
              strcpy(aRes->CurrentExchangeRate, pItem->text);
            }
            /// 每手股数
            else if(strcmp(pFields->text, LOC_TRADE_MIN_GS_JT) == 0)
            {
              strcpy(aRes->MinGuShu, pItem->text);
            }
            /// 最小价差
            else if(strcmp(pFields->text, LOC_TRADE_MIN_JC_JT) == 0)
            {
              strcpy(aRes->MinJiaCha, pItem->text);
            }
          }else{
              
              // (股票代码)
              if (strcmp(pFields->text, LOC_TRADE_STOCK_CODE_HK) == 0)
              {
                  strcpy(aRes->StkCode,pItem->text);
              }
              // 证券名称(股票名称)
              else if (strcmp(pFields->text, LOC_TRADE_STOCK_NAME_HK) == 0)
              {
                  strcpy(aRes->StkName,pItem->text);
              }
              // 股东代码(市场代码)
              else if (strcmp(pFields->text, LOC_TRADE_EXCHANGE_NUM_HK) == 0)
              {
                  strcpy(aRes->MarketId,pItem->text);
              }
              //(可买数量)
              else if (strcmp(pFields->text, LOC_TRADE_BUYABLE_NUMBER_HK) == 0)
              {
                  strcpy(aRes->BuyNum,pItem->text);
              }
              // (可用股数)
              else if (strcmp(pFields->text, LOC_TRADE_USEABLE_NUMBER_HK) == 0)
              {
                  strcpy(aRes->SellNum,pItem->text);
              }
              // 卖3价(卖3价)
              else if (strcmp(pFields->text, LOC_TRADE_SAL3_PRICE_HK) == 0)
              {
                  strcpy(aRes->SPri3,pItem->text);
              }
              // 卖2价(卖2价)
              else if (strcmp(pFields->text, LOC_TRADE_SAL2_PRICE_HK) == 0)
              {
                  strcpy(aRes->SPri2,pItem->text);
              }
              // 卖1价(卖1价)
              else if (strcmp(pFields->text, LOC_TRADE_SAL1_PRICE_HK) == 0)
              {
                  strcpy(aRes->SPri1,pItem->text);
              }
              // 买1价(买1价)
              else if (strcmp(pFields->text, LOC_TRADE_BUY1_PRICE_HK) == 0)
              {
                  strcpy(aRes->BPri1,pItem->text);
              }
              // 买2价(买2价)
              else if (strcmp(pFields->text, LOC_TRADE_BUY2_PRICE_HK) == 0)
              {
                  strcpy(aRes->BPri2,pItem->text);
              }
              // 买3价(买3价)
              else if (strcmp(pFields->text, LOC_TRADE_BUY3_PRICE_HK) == 0)
              {
                  strcpy(aRes->BPri3,pItem->text);
              }
              // 卖5价(卖5价)
              else if(strcmp(pFields->text, LOC_TRADE_SAL5_PRICE_HK ) == 0 )
              {
                  strcpy(aRes->SPri5,pItem->text);
              }
              // 卖4价(卖4价)
              else if(strcmp(pFields->text, LOC_TRADE_SAL4_PRICE_HK) == 0 )
              {
                  strcpy(aRes->SPri4,pItem->text);
              }
              // 买4价(买4价)
              
              else if( strcmp( pFields->text, LOC_TRADE_BUY4_PRICE_HK) == 0 )
              {
                  strcpy(aRes->BPri4,pItem->text);
              }
              // 买5价(买5价)
              else if(strcmp(pFields->text, LOC_TRADE_BUY5_PRICE_HK) == 0 )
              {
                  strcpy(aRes->BPri5,pItem->text);
              }
              // 卖3量(卖3量)
              else if (strcmp(pFields->text, LOC_TRADE_SAL3_VOL_HK) == 0)
              {
                  strcpy(aRes->SVol3,pItem->text);
              }
              // 卖2量(卖2量)
              else if (strcmp(pFields->text, LOC_TRADE_SAL2_VOL_HK) == 0)
              {
                  strcpy(aRes->SVol2,pItem->text);
              }
              // 卖1量(卖1量)
              else if (strcmp(pFields->text, LOC_TRADE_SAL1_VOL_HK) == 0)
              {
                  strcpy(aRes->SVol1,pItem->text);
              }
              // 买1量(买1量)
              else if (strcmp(pFields->text, LOC_TRADE_BUY1_VOL_HK) == 0)
              {
                  strcpy(aRes->BVol1,pItem->text);
              }
              // 买2量(买2量)
              else if (strcmp(pFields->text, LOC_TRADE_BUY2_VOL_HK) == 0)
              {
                  strcpy(aRes->BVol2,pItem->text);
              }
              // 买3量(买3量)
              else if (strcmp(pFields->text, LOC_TRADE_BUY3_VOL_HK) == 0)
              {
                  strcpy(aRes->BVol3,pItem->text);
              }
              // 卖5量(卖5量)
              else if(strcmp(pFields->text, LOC_TRADE_SAL5_VOL_HK) == 0 )
              {
                  strcpy(aRes->SVol5,pItem->text);
              }
              // 卖4量(卖4量)
              else if(strcmp(pFields->text, LOC_TRADE_SAL4_VOL_HK) == 0 )
              {
                  strcpy(aRes->SVol4,pItem->text);
              }
              // 买4量(买4量)
              
              else if( strcmp( pFields->text, LOC_TRADE_BUY4_VOL_HK) == 0 )
              {
                  strcpy(aRes->BVol4,pItem->text);
              }
              // 买5量(买5量)
              else if(strcmp(pFields->text, LOC_TRADE_BUY5_VOL_HK) == 0 )
              {
                  strcpy(aRes->BVol5,pItem->text);
              }
              // 最新(当前价,最近价格)
              else if (strcmp(pFields->text, LOC_TRADE_CUR_PRICE_HK) == 0 || strcmp(pFields->text, LOC_TRADE_NEW_PRICE_HK) == 0)
              {
                  strcpy(aRes->CurPri,pItem->text);
              }
              // 昨收(昨收盘)
              else if (strcmp(pFields->text, LOC_TRADE_PRE_PRICE_HK) == 0)
              {
                  strcpy(aRes->ZSPri,pItem->text);
              }
              // 涨停(涨停)
              else if (strcmp(pFields->text, LOC_TRADE_MAX_DIF_PRICE_HK) == 0)
              {
                  strcpy(aRes->ZT,pItem->text);
              }
              // 跌停(跌停)
              else if (strcmp(pFields->text, LOC_TRADE_MIN_DIF_PRICE_HK) == 0)
              {
                  strcpy(aRes->DT,pItem->text);
              }
              // 涨幅(涨幅)
              else if (strcmp(pFields->text, LOC_TRADE_ZF_PRICE_HK) == 0)
              {
                  strcpy(aRes->ZF,pItem->text);
              }
              // 最小变动单位
              else if (strcmp(pFields->text, LOC_TRADE_MIN_UNIT_HK) == 0)
              {
                  strcpy(aRes->MinUnit,pItem->text);
              }
              // 股东代码
              else if (strcmp(pFields->text, LOC_TRADE_HODLER_ACCOUNT_HK) == 0)
              {
                  strcpy(aRes->StockHolderAccount, pItem->text);
              }
              // 认购上限
              else if (strcmp(pFields->text, LOC_TRADE_SUB_MAX_HK) == 0)
              {
                  strcpy(aRes->SubscribeMax, pItem->text);
              }
              // 申购上限
              else if (strcmp(pFields->text, LOC_TRADE_SUB_APP_MAX_HK) == 0)
              {
                  strcpy(aRes->SubscribeAppMax,pItem->text);
              }
              /// 可用金额
              else if (strcmp(pFields->text, LOC_TRADE_MAX_MONEY_HK) == 0)
              {
                  strcpy(aRes->Money, pItem->text);
              }
              /// 赎回上限
              else if (strcmp(pFields->text, LOC_TRADE_MAX_SELL_HK) == 0)
              {
                  strcpy(aRes->RansomMax, pItem->text);
              }
              /// 现手
              else if(strcmp(pFields->text,LOC_TRADE_CUR_VOL_HK) == 0)
              {
                  strcpy(aRes->CurrentVol, pItem->text);
              }
              /// 风险提示
              else if(strcmp(pFields->text, LOC_TRADE_RISKINFO_SB_HK) == 0)
              {
                  strcpy(aRes->pRiskInfoSB, pItem->text);
              }
              /// 当前汇率
              else if(strcmp(pFields->text, LOC_TRADE_CUR_HL_HK) == 0)
              {
                strcpy(aRes->CurrentExchangeRate, pItem->text);
              }
              /// 每手股数
              else if(strcmp(pFields->text, LOC_TRADE_MIN_GS_HK) == 0)
              {
                strcpy(aRes->MinGuShu, pItem->text);
              }
              /// 最小价差
              else if(strcmp(pFields->text, LOC_TRADE_MIN_JC_HK) == 0)
              {
                strcpy(aRes->MinJiaCha, pItem->text);
              }
          }
		
		pFields = pFields->next;
		pItem = pItem->next;
	}
}

void TradeLvData_ParseContactData(ROW_NODE* aNode, TRADELV_CONTACT_RES *aRes)
{
	if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	COL_NODE *pFile = aNode->next->node;
	ROW_NODE *pLine = aNode->next->next;
	COL_NODE *pItem;
	
	while(pLine)
	{
		pItem = pLine->node;
		while(pFile && pItem)
		{
            if (g_LanguageType == 1) {//繁体
                if(strcmp(pFile->text, LOC_TRADE_CONTACT_MAN_HK)==0)
                {
                    strcpy(aRes->iContactMan, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_PHONE_HK)==0)
                {
                    strcpy(aRes->iPhone, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_MOBILE_HK)==0)
                {
                    strcpy(aRes->iMobile, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_ADDRESS_HK)==0)
                {
                    strcpy(aRes->iAddress, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_ZIPCODE_HK)==0)
                {
                    strcpy(aRes->iZipCode, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_EMAIL_HK)==0)
                {
                    strcpy(aRes->iEmial, pItem->text);
                }
            }
            else//简体
            {
                if(strcmp(pFile->text, LOC_TRADE_CONTACT_MAN_JT)==0)
                {
                    strcpy(aRes->iContactMan, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_PHONE_JT)==0)
                {
                    strcpy(aRes->iPhone, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_MOBILE_JT)==0)
                {
                    strcpy(aRes->iMobile, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_ADDRESS_JT)==0)
                {
                    strcpy(aRes->iAddress, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_ZIPCODE_JT)==0)
                {
                    strcpy(aRes->iZipCode, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_CONTACT_EMAIL_JT)==0)
                {
                    strcpy(aRes->iEmial, pItem->text);
                }
            }


			pFile = pFile->next;
			pItem = pItem->next;
		}
		
		pFile = aNode->next->node;
		pLine = pLine->next;
	}
}

void TradeLvData_ParsePaymentData(ROW_NODE* aNode, TRADELV_PAYMENT_RES *aRes)
{
    
    if (aNode->next == NULL || aNode->next->next == NULL) {
		return;
	}
	
	COL_NODE *pFile = aNode->next->node;
	ROW_NODE *pLine = aNode->next->next;
	COL_NODE *pItem;
	aRes->nCount = 0;
	while(pLine)
	{
		pItem = pLine->node;
		while(pFile && pItem)
		{
            if (g_LanguageType == 0) {
                if(strcmp(pFile->text, LOC_TRADE_BANK_MONEY_TYPE_JT)==0)       //币种
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_MAYACCOUNT_JT)==0)       //可用金额
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iMayAccount, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOACCOUNT_JT)==0)       //需还金额
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoAccount, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOPRINCIPAL_JT)==0)       //融资本金
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoPrincipal, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOINTEREST_JT)==0)       //融资利息
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoInterest, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_FINANCINGCOSTS_JT)==0)       //融资费用
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iFinancingCosts, pItem->text);
                }else if (strcmp(pFile->text,LOC_TRADE_PAYMENT_ACCOUNTBALANCE_JT)==0) {
                    strcpy(aRes->pPayMents[aRes->nCount].iAccountBalace,pItem->text);			//资金余额
                }
            }
            else
            {
                if(strcmp(pFile->text, LOC_TRADE_BANK_MONEY_TYPE_HK)==0)       //币种
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iMoneyType, pItem->text);
                }
                else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_MAYACCOUNT_HK)==0)       //可用金额
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iMayAccount, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOACCOUNT_HK)==0)       //需还金额
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoAccount, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOPRINCIPAL_HK)==0)       //融资本金
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoPrincipal, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_ALSOINTEREST_HK)==0)       //融资利息
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iAlsoInterest, pItem->text);
                }else if(strcmp(pFile->text, LOC_TRADE_PAYMENT_FINANCINGCOSTS_HK)==0)       //融资费用
                {
                    strcpy(aRes->pPayMents[aRes->nCount].iFinancingCosts, pItem->text);
                }else if (strcmp(pFile->text,LOC_TRADE_PAYMENT_ACCOUNTBALANCE_HK)==0) {
                    strcpy(aRes->pPayMents[aRes->nCount].iAccountBalace,pItem->text);			//资金余额
                }
            }

			
			pFile = pFile->next;
			pItem = pItem->next;
		}
		
		pFile = aNode->next->node;
		aRes->nCount++;
		pLine = pLine->next;
	}

}

void TradeLvData_SetCurrentLanguage(int aLanguageType){
    //0：简体  1：繁体
    g_LanguageType = aLanguageType;
}

